﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class Solution78
{
    IList<IList<int>> res = new List<IList<int>>();
    public IList<IList<int>> Subsets(int[] nums)
    {


        IList<int> path = new List<int>();
        res.Add(new List<int>(path));
        DFS(nums, 0, path);
        return res;

    }

    private void DFS(int[] nums, int startIndex, IList<int> path)
    {
     


        for(int i = startIndex; i < nums.Length; i++)
        {
            
            path.Add(nums[i]);
            res.Add(new List<int>(path));
            DFS(nums, i+1, path);
            path.RemoveAt(path.Count-1);

        }

    }
}

public class Program78
{


    static void Main78(string[] args)
    {
        Solution78 solution = new Solution78();
        int[] nums = [1, 2, 3];
        IList<IList<int>> res = solution.Subsets(nums);
        for (int i = 0; i < res.Count; i++)
        {

            for (int j = 0; j < res[i].Count; j++)
            {
                Console.Write(res[i][j] + "  ");
            }
            Console.WriteLine();
        }
    }

}
